package com.hkbigdata.sybx.mapper;

import com.hkbigdata.sybx.bean.UserIdentity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author yangjing
 * @creat 2025-06-04-11:26
 * @email 3010335359@qq.com
 */
@Mapper
public interface UserIdentityMapper {

    /**
     * 添加用户实名信息
     */
    @Insert("INSERT INTO user_identity (real_name, id_card, user_id) " +
            "VALUES (#{realName}, #{idCard}, #{userId})")
    int addUserIdentity(UserIdentity identity);

    /**
     * 通过userId查询用户实名信息
     */
    @Select("SELECT real_name as realName, id_card as idCard, user_id as userId " +
            "FROM user_identity WHERE user_id = #{userId}")
    UserIdentity getUserIdentityByUserId(String userId);

    /**
     * 通过idCard查询用户实名信息
     */
    @Select("SELECT real_name as realName, id_card as idCard, user_id as userId " +
            "FROM user_identity WHERE id_card = #{idCard}")
    UserIdentity getUserIdentityByIdCard(String idCard);
}
